app.controller('messageDataPageCtrl', function($ionicBackdrop, $interval,$stateParams, $state, $scope, $myconfig,$http,$ionicConfig) {

    //接收参数
    var id = $stateParams.id;

    //请求接口 获取资讯详情
    $scope.messageMes = function(id){
        $http.get($myconfig.api.base_host + '/news/news_info?news_id=' + id)
        .then(function(res){
            $scope.messageMesData = res.data.data;
        });
    };

    //判断参数是否接收到 如果接收到则执行请求接口详情，并以接收到的参数为方法执行参数
    if(id){
        $scope.messageMes(id);
    }
    $scope.$on('$ionicView.enter', function(){

        $ionicConfig.views.swipeBackEnabled(false);

  });

    //判定当前设备类型是ios还是android
    var u = navigator.userAgent;
    var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
    var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端

  $scope.changePage = function(){
      if(isiOS){
        $state.go('app.message');
      }else{
        // history.go(-1);location.reload();
        // window.location.href=document.referrer;
        $state.go('app.message');
      }
  };

});
